import draw.*;
import geometry.Posn;
import geometry.*;
import tester.*;
import java.util.*;
import colors.*;

// Examples and tests for the class hierarchy for a computer file system
class Examples{
  
  Examples(){}
                         
  WholeGameWorld myInitialWorld = new WholeGameWorld 
  (new Mfmwg (new Posn(100, 100), 500), 
   new ConsLoS (new Star (10, new Posn(20, 20)),
                new ConsLoS(new Star(15, new Posn(30, 30)),
                            new ConsLoS(new Star
                                        (10, new Posn(50, 50)),
                                        new MtLoS()))));
   
   boolean go(){
    return this.myInitialWorld.bigBang(200, 300, 0.1);
    }    
   
   public static void main(String[] argv){
	    // construct an instance of a TimerWorld
	    Examples w = new Examples();
	    // and run the TimerWorld
	    w.go();
	  }

  
 Star star1 = new Star(10, new Posn(5,5));
 Star star2 = new Star(0, new Posn(10,10));
 Star star3 = new Star(10, new Posn(100, 300));
 Star star4 = new Star(10, new Posn(50, 50));

 Mfmwg m = new Mfmwg(new Posn(50, 50), 50);
 Mfmwg genie1 = new Mfmwg(new Posn(60, 60), 0);

 MtLoS mt = new MtLoS();

 ConsLoS starList = new ConsLoS(this.star1, this.mt);
 ConsLoS starList2 = new ConsLoS(this.star2, this.starList);
 ConsLoS starList3 = new ConsLoS(this.star3, this.starList2);
 ConsLoS starList4 = new ConsLoS(this.star4, this.starList3);

 /* to test:
  *  cons : 
  *  genie : catch onkey 
  *  star: makestar drawstar 
  *  world: onkey 
  * 
  */
 
 //tests for the hitGroundp method in the Star class.
 boolean testHitGroundp(Tester t){
	 return t.checkExpect(this.star1.hitGroundp(), false) &&
	 		t.checkExpect(this.star3.hitGroundp(), true);
 }

 //tests the isFoundp and foundStar methods in the star class and the ConsLoS class..
 boolean testFound(Tester t){
	 return t.checkExpect(star4.isFoundp(m), true) &&
	        t.checkExpect(star4.isFoundp(genie1), false) &&
	        t.checkExpect(starList4.foundStar(m), true) &&
	        t.checkExpect(starList4.foundStar(genie1), false);
 }
 
 boolean testCaughtStar(Tester t){
	 return t.checkExpect(starList4.caughtStar(m), star4);
 }
 
 // tests the method onTick in all classes that implement it
 // star, world, conslos, genie
 boolean testOnTick(Tester t){
	 return t.checkExpect(mt.onTick(m), mt) &&
	        t.checkExpect(m.onTick(), new Mfmwg(m.location, m.fuel - 5)) &&
	        t.checkExpect(starList.onTick(m), new ConsLoS(new Star(9, new Posn(5, 13)), new MtLoS())) &&
	        t.checkExpect(myInitialWorld.onTick(),
	        		       new WholeGameWorld(new Mfmwg (new Posn(100, 100), 495),
	        			   new ConsLoS (new Star (9, new Posn(20, 28)),
	        		                    new ConsLoS(new Star(14, new Posn(30, 38)),
	        		                                new ConsLoS(new Star (9, new Posn(50, 58)),
	        		                                                         new MtLoS())))));
 }
}